-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improved Form Validation Docs #2058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added info about adding constraints to each field as opposed to only using DefaultOptions. Also added a tip about settings validation groups.
``constraints`` option, which accepts a single constraint or an array | ||
of them. | ||
|
||
:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be .. code-block:: php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouterj this is the recommendation in the "contributing page": The :: shorthand is preferred over .. code-block:: php to begin a PHP code block;
http://symfony.com/doc/master/contributing/documentation/overview.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rdohms yes, I know (I wrote those standards). But not in this case. The ::
shorthand indicates a code-block in the indented lines after and replaces ::
with :
. For instance, if you have a sentence like this:
Look what this code does:
.. code-block:: php
// some php code
You should turn it into:
Look what this code does::
// some php code
Those are rendered the same. But if you have a code block without a sentence you shouldn't use this shorthand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouterj ok i'll fix it. But i think that should be said in the guide as well. Also it feels like a double standard.
@wouterj changes made. |
@@ -1581,6 +1581,39 @@ an array of data, instead of an object. In most cases, it's better - and | |||
certainly more robust - to bind your form to an object. But for simple forms, | |||
this is a great approach. | |||
|
|||
.. versionadded:: 2.1 | |||
It is now possible to add constraints directly to the fields using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misleading. validation_constraint
was also applying on the field directly. The difference is that it was impossible to add several constraints
Improved Form Validation Docs
…raints` option on individual forms, which is much easier than adding things globally, as we did in 2.0
Hi Rafael! This is an excellent note to add for 2.1 - it wasn't previously documented. And actually, the docs above this are leftover from 2.0, where it was much more work (involving a Thanks so much for this addition! If anyone sees that I've made a mistake in my commits, please let me know! |
Added info about adding constraints to each field as opposed to only using DefaultOptions.
Also added a tip about settings validation groups.